package shogi;




import javax.swing.ImageIcon;
import javax.swing.JLabel;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author novaterata
 */
public class ShogiPiece extends JLabel{
	private ImageIcon icon;
	private String Orientation;
	private boolean Promoted;
	private int index;
	private char type;

	public ShogiPiece(){
		super();
	}
	
	public ShogiPiece(int index, char type, String Orientation) {
		this.index = index;
		this.Orientation = Orientation;
		this.type= type;
		this.icon = new ImageIcon(getClass().getResource(ShogiBoard.getIconSetDirectory()+type+Orientation+".png"));
		this.setIcon(icon);
	}

	public String getOrientation() {
		return Orientation;
	}

	public void setOrientation(String Orientation) {
		this.Orientation = Orientation;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}
        
        public int getRow() {
                return (this.getIndex() / 9);
        }
        
        public int getColumn(){
                return (this.getIndex() % 9);
        }

	public char getType() {
		return type;
	}

	public void setType(char type) {
		this.type = type;
	}

	public String getLongType(){
		switch(this.type){
			case 'p':
				return "pawn";
			case 'l':
				return "lance";
			case 'n':
				return "knight";
			case 's':
				return "silver";
			case 'g':
				return "gold";
			case 'k':
				return "king";
			case 'b':
				return "bishop";
			case 'r':
				return "rook";
			default:
				return null;
		}
	}

	public boolean isPromoted() {
		return Promoted;
	}

	public void setPromoted(boolean Promoted) {
		this.Promoted = Promoted;
	}
	
}
